import React from 'react';
import {WeaSearchGroup, WeaFormItem, WeaSelect, WeaInput} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EType from './base/EType';
import ETitle from './base/ETitle';

// 日历日程
export default class Content_MeetingCalendar extends React.Component {
    state = {
        selected: this.props.meetingType.selected,
    };
    render() {
        const { meetingType } = this.props;
        let ShowContents = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@k87lhh`} label={getLabel(15935, '显示内容')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <div style={{width: '100px'}}>
                            <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@fnpctg`}
                                options={meetingType.options.map((item) => {
                                    return {key: item.key, selected: false, showname: item.value};
                                })}
                                value={this.state.selected}
                                onChange={value => {
                                    this.setState({selected: value});
                                }}
                            />
                        </div>
            </WeaFormItem>
        );
        let ShowContents1 = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@69v89p`} label={getLabel(15935, '显示内容')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <div style={{width: '100px',textAlign: 'center', lineHeight: '2.3'}}>
                    <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@wt34ns`}
                        options={meetingType.options.map((item) => {
                            return {key: item.key, selected: false, showname: item.value};
                        })}
                        viewAttr = {1}
                        value={this.state.selected}
                        onChange={value => {
                            this.setState({selected: value});
                        }}
                    />
                </div>
            </WeaFormItem>
        );
        return (
            <div>
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@6yjt4f`} title={getLabel(81711, '基本信息')} needTigger={true} showGroup={true}>
                    <EType ecId={`${this && this.props && this.props.ecId || ''}_EType@8ylqke`} ref="eType" value={this.props.eBaseName}/>
                    {this.props.eShareLevel == '2' ? <ETitle ecId={`${this && this.props && this.props.ecId || ''}_ETitle@0wp073`} ref="eTitle" eid={this.props.eid} value={this.props.eTitle} {...this.props}/> : ''}
                    {this.props.eShareLevel == '2' ? ShowContents : ShowContents1}
                </WeaSearchGroup>
            </div>
        );
    }

    getSaveValues() {
        return {
            eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
            eContentMeetingType: this.state.selected
        };
    }
}